using NUnit.Framework;

namespace Solver
{
	/// <summary>
	/// What is the difference between the sum of the squares and the square of the sums?
	/// </summary>
	public class Problem006 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 6; }
		}

		public string Solve()
		{
			return Solve(100).ToString();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual(2640, Solve(10));
			Assert.AreEqual(25164150, Solve(100));
		}

		private static int Solve(int n)
		{
			int diff = 0;
			for (int i = 1; i < n; i++)
				for (int j = i + 1; j <= n; j++)
					diff += i * j;
			return 2 * diff;
		}
	}
}